# import sqlite3
#
#
# def extract_zip():
#     #连接到数据库
#     conn = sqlite3.connect('Model_ZIP.db')
#     cursor = conn.cursor()
#
# # 创建表
#     cursor.execute('''CREATE TABLE IF NOT EXISTS files
#                   (id INTEGER PRIMARY KEY,
#                   name TEXT,
#                   file BLOB)''')
#
# # 读取压缩包文件
#
#     file_path = '../zip/fishO.zip'  # 替换为实际的文件路径
#     zip_name = 'test1.zip'  # 自定义压缩包名称
#     with open(file_path, 'rb') as file:
#         zip_data = file.read()
#
# # 将压缩包数据插入数据库
#     cursor.execute("INSERT INTO files (name, file) VALUES (?, ?)", (zip_name, zip_data))
#     conn.commit()
#
# # 查询数据
#     cursor.execute("SELECT * FROM files")
#     rows = cursor.fetchall()
#     for row in rows:
#         file_id, name, file_data = row
#     # 将数据写入文件
#     with open(name, 'wb') as file:
#         file.write(file_data)
#         print(f"File '{name}' extracted.")
#
# # 关闭游标和数据库连接
#     cursor.close()
#     conn.close()